# -*- coding: utf-8 -*-
import requests


def get_json(url, data):
    ret = requests.post(url, json=data, headers={'Content-Type': 'application/json'})
    return ret.json()


if __name__ == '__main__':
    mod = "cera"
    # mod = "stell"
    url = "http://127.0.0.1:9981/cfgdb"

    cmd = {"line": "1"}

    ret = get_json("%s/%s/list" % (url, mod), cmd)
    ret = ret["data"]

    for d in ret:
        sn = d["sn"]

        cmd = {
                "line": "1",
                "k": sn,
                }

        get_json("%s/%s/rm" % (url, mod), cmd)
